// 起重机智能安全保障平台业务逻辑
import request from '@/utils/request';

/**
 * 获取起重机运行数据
 */
export function getCraneRunningData() {
  return request({
    url: '/api/crane/runningData',
    method: 'get'
  });
}

/**
 * 获取起重机状态数据
 */
export function getCraneStatusData() {
  return request({
    url: '/api/crane/statusData',
    method: 'get'
  });
}

/**
 * 获取基础运维数据
 */
export function getMaintenanceData() {
  return request({
    url: '/api/crane/maintenanceData',
    method: 'get'
  });
}

/**
 * 获取最新告警信息
 */
export function getLatestAlerts() {
  return request({
    url: '/api/crane/latestAlerts',
    method: 'get'
  });
}

/**
 * 获取设备状态摘要
 */
export function getDeviceStatusSummary() {
  return request({
    url: '/api/crane/deviceStatusSummary',
    method: 'get'
  });
}

/**
 * 获取维护计划
 */
export function getMaintenancePlans() {
  return request({
    url: '/api/crane/maintenancePlans',
    method: 'get'
  });
}

/**
 * 模拟获取仪表盘数据
 */
export function getDashboardData() {
  // 模拟数据，实际应该从API获取
  return {
    deviceStatusSummary: {
      totalCrane: 12,
      normalRunning: 10,
      maintenanceStatus: 2,
      routineChecks: 3,
      safetyIssues: 0
    },
    latestAlerts: [
      {
        id: 1,
        craneNumber: 5,
        time: '08:32',
        type: '轻微过载告警',
        action: '已自动调整负载'
      },
      {
        id: 2,
        craneNumber: 8,
        time: '14:15',
        type: '传感器通讯中断',
        action: '已派维护人员处理'
      }
    ],
    maintenancePlans: [
      {
        id: 1,
        content: '起重机#3 计划于明日进行月度维护'
      },
      {
        id: 2,
        content: '起重机#7 需要更换液压系统滤芯'
      },
      {
        id: 3,
        content: '所有设备将在本周五进行安全系统升级'
      }
    ]
  };
}